﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace shenghua.Migrations
{
    public partial class addentity2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "CommodityCollection",
                table: "AbpUsers",
                newName: "Level");

            migrationBuilder.AddColumn<string>(
                name: "City",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "County",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "DetailedAddress",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsDefaultAddress",
                table: "ShippingAddresses",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "PersonName",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "PhoneNumber",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Province",
                table: "ShippingAddresses",
                nullable: true);

            migrationBuilder.AddColumn<float>(
                name: "Amount",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: 0f);

            migrationBuilder.AddColumn<DateTime>(
                name: "BeginTime",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Description",
                table: "MemberCoupons",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndTime",
                table: "MemberCoupons",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Title",
                table: "MemberCoupons",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Name",
                table: "Coupons",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Condition_MinCount",
                table: "Coupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "TimeLimit_Begin",
                table: "Coupons",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<DateTime>(
                name: "TimeLimit_End",
                table: "Coupons",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "AppliedCommodityIds_StringValue",
                table: "Coupons",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Amount_MoneyType",
                table: "Coupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Amount_Value",
                table: "Coupons",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Condition_MinAmount_MoneyType",
                table: "Coupons",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<double>(
                name: "Condition_MinAmount_Value",
                table: "Coupons",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.AddColumn<int>(
                name: "Inventory",
                table: "Commodities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<float>(
                name: "Price",
                table: "Commodities",
                nullable: false,
                defaultValue: 0f);

            migrationBuilder.AddColumn<string>(
                name: "Labels_StringValue",
                table: "Commodities",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "CreatorUserId",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "DeleterUserId",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "DeletionTime",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsDeleted",
                table: "Comments",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "LastModifierUserId",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "UserType",
                table: "Comments",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Groups_StringValue",
                table: "AbpUsers",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Areas",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Areas", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CommodityClasses",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CommodityClasses", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "FriendlyLinks",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FriendlyLinks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Guarantees",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Guarantees", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MemberFormItems",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberFormItems", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MemberGroups",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberGroups", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MemberLevels",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<int>(nullable: true),
                    Tag = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    LinkAddress = table.Column<string>(nullable: true),
                    Icon = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Enabled = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OnlyMemberVisible = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberLevels", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Areas");

            migrationBuilder.DropTable(
                name: "CommodityClasses");

            migrationBuilder.DropTable(
                name: "FriendlyLinks");

            migrationBuilder.DropTable(
                name: "Guarantees");

            migrationBuilder.DropTable(
                name: "MemberFormItems");

            migrationBuilder.DropTable(
                name: "MemberGroups");

            migrationBuilder.DropTable(
                name: "MemberLevels");

            migrationBuilder.DropColumn(
                name: "City",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "County",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "DetailedAddress",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "IsDefaultAddress",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "PersonName",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "PhoneNumber",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "Province",
                table: "ShippingAddresses");

            migrationBuilder.DropColumn(
                name: "Amount",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "BeginTime",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Description",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "EndTime",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Title",
                table: "MemberCoupons");

            migrationBuilder.DropColumn(
                name: "Name",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinCount",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "TimeLimit_Begin",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "TimeLimit_End",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "AppliedCommodityIds_StringValue",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Amount_MoneyType",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Amount_Value",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinAmount_MoneyType",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Condition_MinAmount_Value",
                table: "Coupons");

            migrationBuilder.DropColumn(
                name: "Inventory",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "Price",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "Labels_StringValue",
                table: "Commodities");

            migrationBuilder.DropColumn(
                name: "CreatorUserId",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "DeleterUserId",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "DeletionTime",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "IsDeleted",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "LastModifierUserId",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "UserType",
                table: "Comments");

            migrationBuilder.DropColumn(
                name: "Groups_StringValue",
                table: "AbpUsers");

            migrationBuilder.RenameColumn(
                name: "Level",
                table: "AbpUsers",
                newName: "CommodityCollection");
        }
    }
}
